package com.example.qiniupload.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class UploadResponse {
    
    /**
     * 上传是否成功
     */
    private boolean success;
    
    /**
     * 响应消息
     */
    private String message;
    
    /**
     * 文件URL
     */
    private String url;
    
    /**
     * 文件名
     */
    private String fileName;
    
    /**
     * 文件大小
     */
    private Long fileSize;
    
    public static UploadResponse success(String url, String fileName, Long fileSize) {
        return new UploadResponse(true, "上传成功", url, fileName, fileSize);
    }
    
    public static UploadResponse error(String message) {
        return new UploadResponse(false, message, null, null, null);
    }
}
